<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- <img src="https://m.tuniucdn.com/fb2/t1/G5/M00/44/52/Cii-s1soezyIF2UxABn76u-yKl8AAIwBgB34jAAGfwC3020871" alt=""> -->
    <script>
        function jsonp(url,cb){
            return new Promise((resolve,reject)=>{
                const script = document.createElement('script')
                script.src = `${url}?cb=${cb}`
                // 定义一个回调函数，用于处理服务端返回的数据
                window[cb] = function (data) {
                    resolve(data)
                }
                document.body.appendChild(script)
            })
        }
        jsonp('http://localhost:3000','callback').then(res=>{
            console.log(res)
        })
    </script>
</body>

</html>